/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t_jolt_bin_to_hex_string.c                         */
/*  NOTE      =                                                    */
/*  DATE      = 2016/03/01 by songbb                               */
/*******************************************************************/

#include <CUnit/Basic.h>

#include "frcomm.h"

#include "../../../src/module/tuxedojolt/config.h"
#include <tuxedojolt/jolt_comm.h>

static int __suite_init(void)
{
    return 0;
}

static int __suite_cleanup(void)
{
    return 0;
}

static void __case1(void)
{
    char *p_payload = (char *) "abc";
    char arr_hex[8192] = {0x00};
    jolt_bin_to_hex_string(p_payload, strlen(p_payload), arr_hex);
    CU_ASSERT_STRING_EQUAL(arr_hex, "616263");
}

int add_suite_jolt_bin_to_hex_string(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" jolt_bin_to_hex_string()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    if (CU_add_test(pSuite, "case1", __case1) == NULL)
        return FR_FAIL;

    return FR_SUCC;
}
